package com.chainyoung.component_tmperson.ui.mvp.model;

import com.chainyoung.common.appcommon.entity.CommonList;
import com.chainyoung.common.di.scope.FragmentScope;
import com.chainyoung.common.integration.IRepositoryManager;
import com.chainyoung.common.mvp.BaseModel;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmperson.api.PersonService;
import com.chainyoung.component_tmperson.entity.MyTotalAsset;
import com.chainyoung.component_tmperson.entity.Purse;
import com.chainyoung.component_tmperson.ui.mvp.contract.WalletContact;

import java.util.TreeMap;

import javax.inject.Inject;

import io.reactivex.Flowable;


@FragmentScope
public class WalletModel extends BaseModel implements WalletContact.Model {

    @Inject
    WalletModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);

    }



    @Override
    public Flowable<CommonList<Purse>> getMyPurse(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .getMyPurse(map)
                .compose(RxUtils.<CommonList<Purse>>handleResult());
    }



    @Override
    public Flowable<MyTotalAsset> getMyTotalAsset(TreeMap<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(PersonService.class)
                .getTotalAsset(map)
                .compose(RxUtils.<MyTotalAsset>handleResult());
    }


}